﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WPFTest.Windows
{
    /// <summary>
    /// Interaction logic for TextInputWindow.xaml
    /// </summary>
    public partial class TextInputWindow : Window
    {
        private string text;
        public string Text
        {
            get { return text; }
            set { this.text = value; }
        }

        public TextInputWindow()
        {
            InitializeComponent();
            InitializeEventHooks();
            TextInput.Focus();
        }

        private void InitializeEventHooks()
        {
            OkButton.Click += new RoutedEventHandler(OkButton_Click);
        }

        void OkButton_Click(object sender, RoutedEventArgs e)
        {
            Text = new TextRange(TextInput.Document.ContentStart, TextInput.Document.ContentEnd).Text;
            this.Close();
        }
    }
}
